Create a virtual Game of Tag.
Save and eFile as TagGame-YourName.fla (red)
Upload here as TagGame-YourName.swf (white)
Verify you uploaded it correctly
Create a second character that will be used with your Interactive Character Animation.
Make the second character a symbol.
Create an animation inside the new charcter symbol to create the illusion of movement.
IMPORTANT NOTE - the new character should move in place (as if it is on a treadmill).
Use different keys to control the new character W - Up, S - Down, A - Left, D - Right.
Use HitTest to make something happen if one character tags the other.
- Start File with MiniFig, Hole and all Script except HitTest, click to download.
To move you second character, download the file above and copy the script from lines 8 - 30.
Make sure your instance name matches the instance name you use in the script.
Make a game that works similar to Angry Birds.
Save and eFile as ABGame-YourName.fla (red)
Upload here as ABGame-YourName.swf (white) Verify you uploaded it correctly.
Create a character that is the bird that you are launching. Make it a symbol.
Create a launching mechanism - sling shot, cannon, catapult, etc...
Create a target.
Use ActionScript to make the character fly in an arc across the screen.
Use ActionScript to determine if the character that you launched hits the target.
// This code is only executed once, when the movie first runs
var xSpeedInitial:Number = 50;
var ySpeedInitial:Number = 0;
var aimDegrees:Number = 0;
var canonAngle:Number = 0;
// stops bird_mc animation initially
bird_mc.stop();
// This code is executed every frame using the onEnterFrame
canon_mc.onEnterFrame = function() {
if (Key.isDown(Key.UP)) {
aimDegrees -= 1;
aimCanonDegrees(aimDegrees);
} else if (Key.isDown(Key.DOWN)) {
aimDegrees += 1;
aimCanonDegrees(aimDegrees);
}
if (Key.isDown(Key.SPACE)) {
launchBird(xSpeedInitial, ySpeedInitial);
}
};
function aimCanonDegrees(canonAngle) {
trace("Angle = " + canonAngle);
canon_mc._rotation = canonAngle;
canonAngleRadians = canonAngle * (Math.PI / 180);
ySpeedInitial = Math.tan(canonAngleRadians) * xSpeedInitial;
trace("ySpeed = " + ySpeedInitial);
}
function launchBird(xSpeed, ySpeed) {
bird_mc.onEnterFrame = function() {
bird_mc._x += xSpeed;
bird_mc._y += ySpeed;
// change the ySpeed by gravity, in this case 5
ySpeed += 5;
};
}
Directions for Spring 2012 FInal
Studio 2 & 5 - May 30, 2012
Create a virtual Game of Tag.Save and eFile as TagGame-YourName.fla (red)
Upload here as TagGame-YourName.swf (white)
Verify you uploaded it correctly
IMPORTANT NOTE - the new character should move in place (as if it is on a treadmill).
To move you second character, download the file above and copy the script from lines 8 - 30.
Make sure your instance name matches the instance name you use in the script.
Alternate Directions
Interactive Animation-Hit
Resources
Part 1: Basic Character Programming - from FlashGameTutsAS2 - Keyboard Events - Looks very promising
MiniFig example (in class)
Studio 1 - May 29, 2012
Make a game that works similar to Angry Birds.Save and eFile as ABGame-YourName.fla (red)
Upload here as ABGame-YourName.swf (white)
Verify you uploaded it correctly.
Resources
EventsConditionals
HitTest
Script
// This code is only executed once, when the movie first runsvar xSpeedInitial:Number = 50;
var ySpeedInitial:Number = 0;
var aimDegrees:Number = 0;
var canonAngle:Number = 0;
// stops bird_mc animation initially
bird_mc.stop();
// This code is executed every frame using the onEnterFrame
canon_mc.onEnterFrame = function() {
if (Key.isDown(Key.UP)) {
aimDegrees -= 1;
aimCanonDegrees(aimDegrees);
} else if (Key.isDown(Key.DOWN)) {
aimDegrees += 1;
aimCanonDegrees(aimDegrees);
}
if (Key.isDown(Key.SPACE)) {
launchBird(xSpeedInitial, ySpeedInitial);
}
};
function aimCanonDegrees(canonAngle) {
trace("Angle = " + canonAngle);
canon_mc._rotation = canonAngle;
canonAngleRadians = canonAngle * (Math.PI / 180);
ySpeedInitial = Math.tan(canonAngleRadians) * xSpeedInitial;
trace("ySpeed = " + ySpeedInitial);
}
function launchBird(xSpeed, ySpeed) {
bird_mc.onEnterFrame = function() {
bird_mc._x += xSpeed;
bird_mc._y += ySpeed;
// change the ySpeed by gravity, in this case 5
ySpeed += 5;
};
}